new Vue({
	el: '#app',
	data: function () {
		return {
			loading:false,//进去的加载中显示
			host: window.location.protocol+'//'+window.location.host,
			headers:{
				'app-id':'992020022270580001',
				'appId':'992020022270580001',
				'TRANSACTION-ID':this.uuid(),
				'REQ-TIME':this.getDateYYYYMMDDHHMISS(),
				'SIGN':'',
				'user_id':'-1',
				'communityId':this.communityId,
			},
            communityId:'',
            activeTypeValue: '招工',
            showPicker: false,
            columnsType: [
                {value:'01',text:'电脑'}
            ],
            message:'',
            fileList: [
                // {
                //   url: 'https://img01.yzcdn.cn/vant/leaf.jpg',
                //   status: 'uploading',
                //   message: '上传中...',
                // },
                // {
                //   url: 'https://img01.yzcdn.cn/vant/tree.jpg',
                //   status: 'failed',
                //   message: '上传失败',
                // },
            ],
            resourceAddressValue: '',
            showPickerAdress: false,
            columnsAdress: [
                {value:'01',text:'中国'}
            ],
            value:'',
            resourceTimeValue: '',
            showPickerTime: false,
            currentDate: new Date(),
            value1:'',
            checked:''

		}
	},
	created() {
        var localStorageCommunityId=JSON.parse(localStorage.getItem('hc_currentCommunityInfo'))
		if(localStorageCommunityId){
			this.communityId=localStorageCommunityId.communityId?localStorageCommunityId.communityId:this.getUrlParam("communityId");
		}else{
			this.communityId=this.getUrlParam("communityId");
		}
		this.headers.communityId=this.communityId;
	},
	mounted(){
	},
	filters: {
		subStringThree: function (value) {
			if (!value) return ''
			return value.substring(0,3)
		}
	},
	methods: {
		uuid() {
			let s = [];
			let hexDigits = "0123456789abcdef";
			for (let i = 0; i < 36; i++) {
				s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
			}
			s[14] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
			s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01
			s[8] = s[13] = s[18] = s[23] = "-";
	
			let uuid = s.join("");
			return uuid;
		},
		getDateYYYYMMDDHHMISS(){
			let date = new Date();
			let year = date.getFullYear();
			let month = date.getMonth() + 1;
			let day = date.getDate();
			let hour = date.getHours();
			let minute = date.getMinutes();
			let second = date.getSeconds();
			if (month < 10) {
				month = '0' + month;
			}
			if (day < 10) {
				day = '0' + day;
			}
			if (hour < 10) {
				hour = '0' + hour;
			}
			if (minute < 10) {
				minute = '0' + minute;
			}
			if (second < 10) {
				second = '0' + second;
			}
			return year + "" + month + "" + day + "" + hour + "" + minute + "" + second;
		},
		getUrlParam(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
			var r = window.location.search.substr(1).match(reg); //匹配目标参数
			if (r != null) return unescape(r[2]);
			return null; //返回参数值	  
		},
        onConfirm(value) {
            this.activeTypeValue = value.text;
            this.showPicker = false;
        },
        onConfirmAdress(value) {
            this.resourceAddressValue = value.text;
            this.showPickerAdress = false;
        },
        onConfirmTime(value){
            console.log(value)
            this.resourceTimeValue = this.timeFormat(value);
            this.showPickerTime = false;
        },
        timeFormat(time) { // 时间格式化 2019-09-08
             let year = time.getFullYear();
             let month = time.getMonth() + 1;
             let day = time.getDate();
             return year + '-' + month + '-' + day
        },
        onOversize(file) {
            console.log(file);
            vant.Toast('文件大小不能超过 1M');
        },
        afterRead(file) {

            file.status = 'uploading';
            file.message = '上传中...';
      
            setTimeout(() => {
              file.status = 'done';
              file.message = '上传完成';
            }, 1000);

        },
		submitBtn(){
            vant.Toast.success('提交成功！');
        }

        
      
	}
});